package models;

import siena.*;
import java.util.List; 

public class Profile extends Model {
	
	public enum ProfileType { 	
		 ADMIN("admin"), INTERNSHIP("internal"), FAMILIAR("familiar"); 
		
		 private String name;
		
		ProfileType(String n) {
			this.name = n;
		}
		
		public String getName() {
			return this.name;
		}
	}
	
	@Id(Generator.AUTO_INCREMENT)
	public Long id;
	
	public ProfileType type;
	
	Profile(ProfileType t) {
		this.type = t;
	}
	
	static Query<Profile> all() {
		return all(Profile.class);
	}
	
	public static List<Profile> findAll() {
		return all().fetch();
	}
	
	public static int count() {
		return all().count();
	}
	
	public static Profile findById(long id) {
		return all().filter("id", id).get();
	}
	
	public static Profile findByType(ProfileType type) {
		return all().filter("type", type).get();
	}
}